{% extends "base_generic.html" %}

{% block content %}

<h1>{{ blog.name }}</h1>
<p><strong>Post date</strong> {{ blog.post_date }}</p>
<p><strong>Author:</strong> <a href="{% url 'blogs-by-author' blog.author.pk %}">{{ blog.author }}</a></p>
<p><strong>Description:</strong></p>
<p style="white-space:pre-wrap;">{{ blog.description }}</p>

<div style="margin-left:20px;margin-top:20px">
<h4>Comments</h4>

{% for comment in blog.blogcomment_set.all %}
<hr>
<p>{{comment.author}} ({{comment.post_date}}) - {{comment.description}}</p>
{% endfor %}
<hr>
{% if user.is_authenticated %}
  <a href="{% url 'blog_comment' blog.id %}">Add a new comment</a></p>
{% else %}
  <p><a href="{% url 'login'%}?next={{request.path}}">Login</a> to add a new comment</p>
{% endif %} 


</div>
{% endblock %}

